package com.woniu.microprojectserver.buildmag.service.impl;

import com.woniu.microcommonsserver.entity.BuildInfoEntity;
import com.woniu.microprojectserver.buildclassmag.mapper.BuildClassMapper;
import com.woniu.microprojectserver.buildmag.mapper.BuildMapper;
import com.woniu.microprojectserver.buildmag.service.IBuildService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ：pengchufeng
 * @date ：Created in 2021/1/30
 * @description：项目service接口实现
 */
@Transactional(readOnly = true)
@Service
public class BuildServiceImpl implements IBuildService {

    @Resource
    private BuildMapper buildMapper;

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public List<BuildInfoEntity> findByRank() {
        return buildMapper.findByRank();
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public List<BuildInfoEntity> findAll() {
        return buildMapper.findAll();
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public BuildInfoEntity findById(String id) {
        return buildMapper.findById(id);
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public List<BuildInfoEntity> findByHId(String id) {
        return buildMapper.findByHId(id);
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public boolean add(BuildInfoEntity buildInfoEntity) {
        buildMapper.add(buildInfoEntity);
        return true;
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public boolean update(BuildInfoEntity buildInfoEntity) {
        buildMapper.update(buildInfoEntity);
        return true;
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public boolean delete(String id) {
        buildMapper.delete(id);
        return true;
    }


}
